/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SLE_LITE_ADVANCE_SETTING_H
#define SLE_LITE_ADVANCE_SETTING_H
#include <stdint.h>
#include "sle_connect_config.h"
#include "sle_error_code.h"

#define SLE_NV_CONNECT_ID                       0x2152
#define SLE_NV_CONNECT_CONFIG_MODE0_ID          0x2153
#define SLE_NV_CONNECT_CONFIG_MODE1_ID          0x2154
#define SLE_NV_SEEK_ID                          0x2155
#define SLE_NV_ANNOUNCE_ID                      0x2156
#define SLE_NV_DEFAULT_CONNECT_ID               0x2157

#define SLE_NV_CONNECT_ID_DATA_LEN              6
#define SLE_NV_CONNECT_CONFIG_MODE_DATA_LEN     20
#define SLE_NV_SEEK_CONFIG_DATA_LEN             20
#define SLE_NV_ANNOUNCE_CONFIG_DATA_LEN         24

#define SLE_NV_WORK_MODE_POS                    5

#define SLE_NV_WORK_MODE_NORMAL_SPEED           0
#define SLE_NV_WORK_MODE_LOW_SPEED              1

#define COMBINE_BYTS_16(low, high) (((uint16_t)(high) << 8) | (low))
#define COMBINE_BYTS_32(index1, index2, index3, index4) \
        (((uint32_t)(index4) << 24) | ((uint32_t)(index3) << 16) | ((uint32_t)(index2) << 8) | (index1))

//SleRecommendSendSize
typedef struct {
    uint16_t connectId;
    uint32_t recomSendDataSize;
} SleRecommendSendSize;
void InitSleRecommendSendSize(void);
SleErrorCode SetRecomSendDataSizeAdvance(uint16_t connectId, uint32_t mtu);
SleErrorCode GetRecomSendDataSizeAdvance(uint16_t connectId, uint32_t *recomSendDataSize);
void AddRecomSendDataToMap(uint16_t connectId, uint32_t dataSize);
void RemoveRecomSendDataToMap(uint16_t connectId);

#endif